package demo.main;

import demo.domain.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class Main {
    public static void main(String[] args) {
        Person person = new Person().setName("hkx").setPersonNo("p001").setSex("男");
        Configuration configuration=new Configuration().configure();
        SessionFactory sessionFactory = configuration.buildSessionFactory();
        Session session = sessionFactory.openSession();
        session.beginTransaction();
//        session.save(person);
        session.persist(person);
        session.getTransaction().commit();
        session.close();
        sessionFactory.close();

    }
}
